package com.example.hkt.config;




import net.sourceforge.tess4j.Tesseract;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author: zhanglm
 * @CreateDate: 2025-03-24 11:00
 * @FullNameClass: com.example.hkt.config.TesseractOcrConfig
 * @Description:
 */
@Configuration
public class TesseractOcrConfig {

    @Value("${test4j.datapath}")
    private String dataPath;

    @Bean
    public Tesseract tesseract() {

        Tesseract tesseract = new Tesseract();
        // 设置训练数据文件夹路径
        tesseract.setDatapath(dataPath);
        // 设置为中文简体
        tesseract.setLanguage("chi_sim");
        return tesseract;
    }

}
